// import { message } from 'antd';
import { verify } from '@/services/verify/verify';

const VerifyModel = {
  namespace: 'verify',
  state: {
    isModalVisible: false,
  },
  effects: {
    *submit({ payload }, { call, put }) {
      const response = yield call(verify, payload);
      yield put({
        type: 'uploadHandle',
        payload: response,
      });
    },
    *hideModal({ payload }, { put }) {
      yield put({
        type: 'okHandle',
        payload,
      });
    },
  },
  reducers: {
    uploadHandle(state, { payload }) {
      return { ...state, isModalVisible: payload.status === 'ok' };
    },
    okHandle(state, { payload }) {
      return { ...state, isModalVisible: payload };
    },
  },
};
export default VerifyModel;
